

FROM ubuntu:16.04
MAINTAINER liang <qitianliang006@gmail.com>


# modify update sources
# RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/mirrors.aliyun.com\/ubuntu\//g' /etc/apt/sources.list

RUN apt-get clean && apt-get update && apt-get install -y locales tzdata
# modify the locale
ENV TZ=Asia/Shanghai

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN dpkg-reconfigure --frontend noninteractive tzdata

# Ensure UTF-8 locale

RUN locale-gen zh_CN.UTF-8 && DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales
RUN locale-gen zh_CN.UTF-8
ENV LANG zh_CN.UTF-8
ENV LANGUAGE zh_CN:zh
ENV LC_ALL zh_CN.UTF-8
# avoid start error
RUN sed -i "s/^exit 101$/exit 0/" /usr/sbin/policy-rc.d
# ssh
RUN apt-get update && apt-get install -y openssh-server \
        python3-dev \
        python3-pip \
	&& cd /usr/local/bin \
	&& ln -s /usr/bin/python3 python \
	&& pip3 install  --upgrade pip

# remove apt/lists
RUN rm -rf /var/lib/apt/lists/*
# RUN mkdir /var/run/sshd
RUN echo 'root:tQ84TlNbDObb' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile

# Install anaconda for python 3.6
#RUN wget --quiet https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.2.0-Linux-x86_64.sh -O ~/anaconda.sh && \
#    /bin/bash ~/anaconda.sh -b -p /opt/conda && \
#    rm ~/anaconda.sh && \
#    echo "export PATH=/opt/conda/bin:$PATH" >> ~/.bashrc

# Initialize workspace

EXPOSE 22
# USER developer
CMD ["/usr/sbin/sshd", "-D"]
